﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.ValentineUI {
    import flash.events.*;
    import flash.display.*;
    import flash.geom.*;
    import Events.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import Classes.util.*;
    import com.greensock.*;
    import Display.*;
    import Display.aswingui.*;

    public class ValentineDialog extends GenericDialog {

        public static const TAB_MAKE:int = 0;
        public static const TAB_ADMIRE:int = 1;
        public static const TAB_ACHIEVE:int = 2;

        public static var DEFAULT_TAB:int = 0;
        public static var assetDict:Dictionary = new Dictionary();

        public function ValentineDialog(){
            super("", "", 0, null, "ValUI");
            this.addEventListener(DataItemEvent.CLOSE_DIALOG, this.onCloseValentineDialog, false, 0, true);
        }
        override protected function loadAssets():void{
            Global.delayedAssets.get(DelayedAssetLoader.VALENTINES_ASSETS, makeAssets);
        }
        override protected function createAssetDict():Dictionary{
            assetDict["dialog_bg"] = (new m_comObject.valentinesDay_bg() as DisplayObject);
            assetDict["tab_unselected"] = m_comObject.valentinesDay_tab_unselected;
            assetDict["tab_selected"] = m_comObject.valentinesDay_tab_selected;
            assetDict["admirersBG"] = m_comObject.valentinesDay_admirersBG;
            assetDict["valentineBG"] = m_comObject.valentinesDay_valentineBG;
            assetDict["noportrait"] = m_comObject.valentinesDay_admirerCard_blank;
            assetDict["heartBorder"] = m_comObject.valentinesDay_newHighlight;
            assetDict["counterHeart"] = m_comObject.valentinesDay_numbersHeart;
            assetDict["left_blue"] = m_comObject.valentinesDay_rewardArea_left_blue;
            assetDict["middle_blue"] = m_comObject.valentinesDay_rewardArea_middle_blue;
            assetDict["middle_white"] = m_comObject.valentinesDay_rewardArea_middle_white;
            assetDict["right_white"] = m_comObject.valentinesDay_rewardArea_right_white;
            assetDict["rewardCard_locked"] = m_comObject.valentinesDay_rewardCard_locked;
            assetDict["rewardCard_unlocked"] = m_comObject.valentinesDay_rewardCard_unlocked;
            assetDict["rewardClaimed"] = m_comObject.valentinesDay_rewardClaimed;
            assetDict["prev_normal"] = m_comObject.market_prev_up;
            assetDict["prev_down"] = m_comObject.market_prev_down;
            assetDict["prev_over"] = m_comObject.market_prev_over;
            assetDict["next_normal"] = m_comObject.market_next_up;
            assetDict["next_down"] = m_comObject.market_next_down;
            assetDict["next_over"] = m_comObject.market_next_over;
            return (assetDict);
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            return (new ValentineDialogView(_arg1, m_message, m_title, m_type, m_callback));
        }
        protected function onCloseValentineDialog(_arg1:DataItemEvent):void{
            this.close();
        }
        override public function centerPopup():void{
            var _local1:Rectangle;
            var _local2:Point;
            if (parent){
                _local1 = getRect(parent);
                _local2 = new Point(4, Global.stage.stageHeight);
                this.x = _local2.x;
                this.y = (_local1.y + _local2.y);
            };
        }
        override protected function showTween():void{
            var me:* = null;
            ASwingHelper.prepare(this.m_jwindow);
            this.mouseEnabled = (this.mouseChildren = false);
            this.visible = true;
            this.centerPopup();
            var rect:* = getRect(parent);
            var newY:* = ((Global.stage.stageHeight / 2) - (this.m_jwindow.getHeight() / 2));
            me = this;
            TweenLite.to(this, 0.5, {
                y:newY,
                onComplete:function ():void{
                    me.mouseChildren = (me.mouseEnabled = true);
                }
            });
        }
        override protected function onShow():void{
            if (m_shown == false){
                if (useSystemCursor()){
                    m_cursorId = UI.setCursor(null);
                };
                this.mouseEnabled = (this.mouseChildren = true);
                m_shown = true;
                Global.stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreen);
            } else {
                m_showOnLoad = true;
            };
            if (!Global.guide.isActive()){
                Sounds.play("dialogSpawn");
            };
        }

    }
}//package Display.ValentineUI 
